<?php

require dirname(__FILE__).'/../config.php';

$root_dir = '../';

include WP_VERSION_PATH . '/header.php';

echo '<h2>WP Version Installer</h2>'."\n\n";

if( (false === USE_SQLITE) && (false === USE_MYSQL) )
{
	if( true === wp_version_install_serialized())
		echo '<p><strong>Done!</strong></p>';
	else
		echo '<p>Failed!</p>';
}
else if( (true === USE_SQLITE) && (false === USE_MYSQL) )
{
	if( true === wp_version_upgrade_sqlite())
		echo '<p><strong>Done!</strong></p>';
	else
		echo '<p>Failed!</p>';
}

include WP_VERSION_PATH . '/footer.php';

function wp_version_upgrade_sqlite()
{
	$pdo = new PDO('sqlite:'.SQLITE_PATH);
	$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	
	return true;
}